﻿using System;

namespace ConsoleApp6
{
    class Program
    {
        static void Main(string[] args)
        {
            DateTime dt = DateTime.Now;
            Console.WriteLine(dt.ToString("yyyy-MM-dd hh-mm"));
            Console.WriteLine("当前时间:" + dt);
            Console.WriteLine("当前周几:" + dt.ToString("dddd"));
            Console.WriteLine("当前月份:" + dt.ToString("MM"));
            Console.WriteLine("当前几号:" + dt.ToString("dd"));
            //计算几天之差
            DateTime dt1 = Convert.ToDateTime("2017-08-08");
            DateTime dt2 = Convert.ToDateTime("2017-08-20");
            TimeSpan span = dt2.Subtract(dt1);
            int DayDiff = span.Days;
            Console.WriteLine("相差："+DayDiff+"天");

            //计算一年的三月有几天
            int Days = DateTime.DaysInMonth(2020, 3);
            Console.WriteLine("3月份有"+Days+"天");

            //字符串
            var  fish = "鱼喝不醉";
            Console.WriteLine("鱼喝不醉一共有："+fish.Length+"字");

            Console.WriteLine("字符串的第一个是："+fish[0]);
            Console.WriteLine("字符串的最后一个是："+fish[fish.Length-1]);

            var pig = "朱姐上学了";
            Console.WriteLine(pig);
            var pig2 = pig.IndexOf("朱");
            Console.WriteLine("朱出现在第："+pig2);
            Console.WriteLine(pig.LastIndexOf("了"));
            Console.WriteLine(pig.IndexOf("姐"));

            var pig3 = pig.Replace("上", "退");
            var pigg = pig.Replace("朱", "猪");
            Console.WriteLine(pig3);
            Console.WriteLine(pigg);

            var pig4 = pig.Substring(2);
            Console.WriteLine(pig4);

            var pig5 = pig.Insert(3,"大");
            Console.WriteLine(pig5);

            var big = "pppYYY";
            Console.WriteLine("转换成为大写："+big.ToUpper());
            var small = "lkjhPOI";
            Console.WriteLine("转换成为小写："+small.ToLower());



        }
    }
}
